<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       function isObj(obj)
       {
         if(typeof obj!="object"||obj == null)
         {
             return false;
         }
         return true;
       }
          
         function deepCopy(originObj)
         {
             if(!isObj(originObj))
             {
                return originObj;
             }
             let obj = Array.isArray(originObj)?[]:{};
             for(key in originObj)
             {
                 obj[key] = deepCopy(originObj[key]);
             }
             return obj;
         }
         let person1 = {
            name:"cq",
            age:"10",
            friends:["james","curry","kobe","jordan","cc"]
         }
         let person2 = deepCopy(person1);
         console.log(person1.friends === person2.friends);
         person1.friends.push("小孩子");
         console.log(person1.friends);
         console.log(person2.friends);
    </script>
</body>
</html>